-
-
Notifications
You must be signed in to change notification settings - Fork 0
Add push option to export CLI #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Unconsented Data Push and Error Suppression
The pushRepos
method hardcodes remote repository URLs, pushing user data to specific external repositories without consent. It uses git push --force
, risking remote history overwrite and data loss. Furthermore, all git
command errors are silently ignored, hiding failures. This includes git remote add origin
failing on subsequent runs if the remote exists, potentially causing git push
to fail or push to an unintended remote.
packages/cli/src/notion/index.ts#L733-L743
notion-node/packages/cli/src/notion/index.ts
Lines 733 to 743 in 4c84671
run('git branch -M main', this.folder) | |
run('git remote add origin https://github.com/texonom/texonom-raw.git', this.folder) | |
run('git push -u origin main --force', this.folder) | |
// push md | |
run('git init', this.md) | |
run('git add .', this.md) | |
run(`git commit -m "${message}"`, this.md) | |
run('git branch -M main', this.md) | |
run('git remote add origin https://github.com/texonom/texonom-md.git', this.md) | |
run('git push -u origin main --force', this.md) |
Bug: Git Command Failures Silently Ignored
The run
helper function within pushRepos()
silently ignores all git
command failures via an empty catch block. This prevents users from being notified of critical issues (e.g., authentication, network, or repository access problems), leading to a false sense of success, hindering debugging, and potentially leaving repositories in inconsistent states.
packages/cli/src/notion/index.ts#L720-L744
notion-node/packages/cli/src/notion/index.ts
Lines 720 to 744 in 4c84671
pushRepos() { | |
const run = (cmd: string, cwd: string) => { | |
try { | |
execSync(cmd, { cwd, stdio: 'ignore' }) | |
} catch {} | |
} | |
const message = new Date().toString() | |
// push raw | |
run('git init', this.folder) | |
run('git add .', this.folder) | |
run(`git commit -m "${message}"`, this.folder) | |
run('git branch -M main', this.folder) | |
run('git remote add origin https://github.com/texonom/texonom-raw.git', this.folder) | |
run('git push -u origin main --force', this.folder) | |
// push md | |
run('git init', this.md) | |
run('git add .', this.md) | |
run(`git commit -m "${message}"`, this.md) | |
run('git branch -M main', this.md) | |
run('git remote add origin https://github.com/texonom/texonom-md.git', this.md) | |
run('git push -u origin main --force', this.md) | |
} |
BugBot free trial expires on June 13, 2025
You have used $0.00 of your $0.00 spend limit so far. Manage your spend limit in the Cursor dashboard.
Was this report helpful? Give feedback by reacting with 👍 or 👎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a --push
flag to the export CLI, enabling automatic Git pushes of exported Notion data to two remote repositories.
- Introduces a
push
property and command‐line flag - Implements a
pushRepos()
method that initializes Git repos and force‐pushes to designated remotes - Hooks the new flag into the export command to run
pushRepos()
when requested
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
packages/cli/src/notion/index.ts | Imported execSync , added push flag/property, implemented git push logic in pushRepos() |
packages/cli/src/notion/export.ts | Added --push option to CLI and wired it to invoke pushRepos() |
Comments suppressed due to low confidence (1)
packages/cli/src/notion/index.ts:721
- The new
pushRepos()
logic isn’t covered by tests—consider adding unit or integration tests to verify the git commands execute as expected.
pushRepos() {
const run = (cmd: string, cwd: string) => { | ||
try { | ||
execSync(cmd, { cwd, stdio: 'ignore' }) | ||
} catch {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Silently swallowing errors makes debugging push failures difficult; consider logging caught exceptions or at least printing a warning.
} catch {} | |
} catch (error) { | |
console.error(`Failed to execute command "${cmd}" in directory "${cwd}":`, error.message); | |
} |
Copilot uses AI. Check for mistakes.
Summary
--push
flag to export commandtexonom-raw
andtexonom-md
Testing
pnpm test
(fails: vitest not found)pnpm lint
(fails: eslint command issue)https://chatgpt.com/codex/tasks/task_e_6842d06cc8908327aba1258d471728c9